/*
 * @Author: ruins
 * @Date: 2022-01-17 10:12:08
 * @LastEditors: ruins
 * @LastEditTime: 2022-01-18 15:13:29
 * @FilePath: \white-dragon\src\router\index.js
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Attendance from './modules/attendance'
import Exercise from './modules/exercise'
import Notes from './modules/notes'
import Personal from './modules/personal'
import Position from './modules/position'
import Resume from './modules/resume'
import Suggestion from './modules/suggestion'
import Layout from '../layout'

Vue.use(VueRouter)

export const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/course',
    children: [{
      path: 'course',
      name: 'Course',
      component: () => import('../views/Course/index.vue')

    }]
  },
  // 出勤
  {
    path: '/attendance',
    name: 'Attendance',
    component: Layout,
    children: [{
      path: '',
      name: 'Attendance',
      component: () => import('../views/Attendance'),
      meta: {
        title: '出勤',
        icon: 'tree'
      }
    }]
  },
  {
    path: '/notes',
    name: 'notes',
    component: Layout,
    children: [{
      path: '',
      name: 'Notes',
      component: () => import('../views/Notes'),
      meta: {
        title: '笔记',
        icon: 'tree'
      }
    }]
  },
  {

    path: '/exercise',
    name: 'exercise',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Exercise',
        component: () => import('@/views/Exercise')
      },
      {
        path: 'pagelist',
        name: 'pagelist',
        component: () => import('@/views/Exercise/components/pageList')
      }
    ]

  },
  {
    path: '/suggestion',
    name: 'suggestion',
    component: Layout,
    children: [{
      path: '',
      name: 'Suggestion',
      component: () => import('@/views/Suggestion'),
      meta: {
        title: '建议',
        icon: 'tree'
      }
    },
    {
      path: '/makeSuggestion',
      name: 'makeSuggestion',
      component: () => import('@/views/Suggestion/components/make-suggestion')
    }
    ]
  },
  {
    path: '/course',
    name: 'course',
    component: Layout,
    children: [{
      path: '',
      name: 'Course',
      component: () => import('@/views/Course'),
      meta: {
        title: '课程',
        icon: 'tree'
      }
    }]

  },
  {
    path: '/Resume', // 路径
    name: 'Resume', // 给路由规则加一个name
    component: Layout, // 组件
    children: [
      {
        path: '',
        name: 'Resume', // 这里当二级路由的path什么都不写的时候 表示该路由为当前二级路由的默认路由
        component: () => import('@/views/Resume'),
        meta: {
          // meta属性的里面的属性 随意定义 但是这里为什么要用title呢， 因为左侧导航会读取我们的路由里的meta里面的title作为显示菜单名称
          title: '个人简历'
        }
      }
    ]

  },
  {
    path: '/position',
    name: 'position',
    component: Layout,
    children: [
      {
        path: '',
        name: 'position',
        component: () => import('@/views/Position'),
        meta: { title: '公司招聘' }
      },
      {
        path: 'info',
        name: 'postionInfo',
        component: () => import('@/views/Position/components/Recruitment'),
        meta: { title: '招聘详情' }
      }
    ]
  }

]
export const dynamicRoutes = [
  Attendance,
  Exercise,
  Notes,
  Personal,
  Position,
  Resume,
  Suggestion
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
